package imp.haemers 
{
	import flash.display.Sprite;
	import imp.haemers.data.vo.Book;
	import nl.haemers.utils.ObjectReader;
	
	import nl.haemers.data.serializers.XMLSerializer;
	/**
	 * ...
	 * @author Jonathan
	 * Real life test case!
	 */
	public class Main extends Sprite 
	{
		[Embed(source="data/xml/books.xml", mimeType="application/octet-stream")]
		private var BooksSource							:Class;
		private var _booksXML							:XML;
		
		private var _xmlSerializer:XMLSerializer;
		public function Main() 
		{
			init();
		}
		
		/** Public methods **/
		
		/** Getters & Setters **/
		
		/** Protected methods **/
		
		/** Private methods **/
		private function init():void 
		{
			_booksXML = XML(new BooksSource());
			
			_xmlSerializer = new XMLSerializer(true);
			var result:Array = _xmlSerializer.deserialize(_booksXML, Book);
			
			//trace(new ObjectReader().readObject(result[0]));
			//*
			var reader:ObjectReader = new ObjectReader();
			for (var i:int = 0; i < result.length; i++)
			{
				trace(reader.readObject(result[i]));
			}
			//*/
		}
	}

}